from scipy.io import loadmat

from LearnPy.MIClustering.MyBamic.bag_dist_matrix import bag_dist_matrix
from LearnPy.MIClustering.MyBamic.bamic import bamic

from LearnPy.MIClustering.MyBamic.bartmip import bartmip
if __name__=="__main__":
    path = './musk1+.mat'
    musk = loadmat(path)

    #分簇的个数
    cluster_num = 14
    #邻居个数
    n_neighbors = 3
    # 包与包的距离矩阵
    dist_matrix = bag_dist_matrix(musk)
    # 包与簇中心的距离矩阵
    bag_center_dist = bamic(musk, 14, dist_matrix)



    test_data = [[2.72175697, 2.85115598, 2.84974861, 3.11140631, 2.47236575, 2.42575037,
                  2.41921842, 2.54050109, 3.22233739, 1.90742322, 2.7447117, 2.68161344,
                  3.23083086, 1.96454595]]


    classifier = bartmip(musk,cluster_num,n_neighbors,dist_matrix,bag_center_dist) #训练好的分类器
    result = classifier.predict(test_data)#result是一个一维数组，里面只有一个预测结果
    print("预测结果:", int(result[0]))
